<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <title>退款退货</title>
    <link rel="stylesheet" href="__PUBLIC__/Home/css/memberOrder.css">
    <include file="Public/common_js"/>
</head>
<body>
<div class="warp">
    <!--退款top-->
    <div class="member-refund-top member-refund-return">
        <i></i>
        <ul class="">
            <li class="active"><span>申请退货</span></li>
            <li><span>审核受理</span></li>
            <li><span>进行退货</span></li>
            <li><span>退货确认</span></li>
            <li><span>完成退款</span></li>
        </ul>
    </div>
    <!--退款金额操作-->
    <input id="order_id" type="hidden" value="{$orderMsg['order_id']}" />
    <div class="member-refund-price mgTop">
        <label>退款金额：</label>
        <input id="price" class="drawback-txt" type="text" value="{$orderMsg.total_amount}" />
        <input id="max-back-price" type="hidden" value="{$orderMsg.total_amount}"/>
        <span class="drawback-tip">最大可退款金额：<em>{$orderMsg.total_amount}元</em></span>
    </div>
    <!--退款商品列表-->
    <div class="refund-goods-list mgTop">
        <div class="refund-shop-title">
            请选择退款商品
            <span><a>退货须知</a></span>
        </div>
        <foreach name="goodsMsg" item="v">
            <if condition="$v['nums']-$v['refund_goods_num'] neq 0">
                <div class="single-item dataItem" data-id="{$v.item_id}" data-num="<?php echo $v['nums']-$v['refund_goods_num'];?>" data-price="{$v.price}" >
                    <div class="swipe-item">
                        <a href="{:url('goods/detail',['id'=>$v['store_pid']])}" class="img"><img src="{$v.goods_id|getThumb=###}"></a>
                        <div class="goods-text">
                            <a href="{:url('goods/detail',['id'=>$v['store_pid']])}" class="name">{$v.name}</a>
                            <p class="price" value="{$v.price}">¥{$v.price}</p>
                            <p class="change-number">
                                <a href="javascript:void(0);" class="plus">+</a>
                                <input type="text" value="<?php echo $v['nums']-$v['refund_goods_num'];?>" class="goods_number" />
                                <a href="javascript:void(0);" class="minus">-</a>
                            </p>
                        </div>
                    </div>
                    <div class="static-item">
                        <div class="choice-btn"></div>
                    </div>
                </div>
            </if>
        </foreach>
        <div id="freight" class="single-item single-refund-item" data-fee="{$orderMsg['cost_freight']}">
            <div class="swipe-item">
                <span class="single-refund-price">退运费&nbsp;¥{$orderMsg['cost_freight']}<span class="sp-ommit">（退运费请先与客服联系）</span></span>
            </div>
            <div class="static-item">
                <div class="choice-btn"></div>
            </div>
        </div>
    </div>
    <!--退款原因-->
    <div class="refund-mes-form feedback">
        <h4>退款原因</h4>
        <div class="select-template mgTop">
            <input id="refundReason" type="text" placeholder="请选择退款原因" />
            <i></i>
        </div>
        <h4 class="mgTop">联系电话</h4>
        <input id="telephone" type="text" placeholder="请输入联系电话以便能及时联系您" class="mgTop">
        <h4 class="mgTop">上传图片凭证<font class="sp-ommit">（最多可上传3张）</font></h4>
        <input type="hidden" id="upload_image">
        <div class="upload-content-box">
            <div id="upload-files" class="upload-file-list">
            </div>
            <i class="upload-btn">
                <input type="file" name="file" id="upImgBtn" />
            </i>
        </div>
        <h4 class="mgTop">备注说明<span class="sp-ommit">（可不填）</span></h4>
        <textarea id="refundComment" placeholder="请输入其他说明" class="mgTop"></textarea>
        <p class="mgTop"><a href="#" class="btn btn-second btn-block btn-refund-tps">申请退款</a></p>
    </div>
</div>
<!-- 绑定手机弹窗 -->
<!--<div class="alert-popup member-refund-tips" style="display: none">
    <p>选择订单中部分商品退款后，未满足59元免运费，将自动扣除5元免运金额。</p>
    <p><a href="javascript:void(0);" style="width: 100%" class="confirm">知道了</a></p>
</div>-->
<script type="text/javascript">
    var maxSaveNums = 3;
    var curSaveNums = 0;
    var isDeleting = false;
    function delImage(o){
        if(isDeleting) return;
        isDeleted = true;
        $(o).parent().remove();
        curSaveNums--;
        var rs = "";
        $("#upload-files img").each(function(i, o){
            rs += (i == 0 ? "" : "#" ) + $(this).attr("src").replace(/^\/Uploads\//i, "");
        });
        $('#upload_image').val(rs);
        isDeleted = false;
    }
    function loadImageEvent(){
        $("#upImgBtn").AjaxFileUpload({
            action : "/Home/Upload/index",
            type: "img",
            callback: function(key){
                if(key == "type"){
                    _global.promote.alertPopup("请选择图片类型的文件！");
                }else if(key == "process"){
                    _global.promote.alertPopup("有图片正在上传,请稍等！");
                }else if(key == "range"){
                    _global.promote.alertPopup("最多只可以上传"+maxSaveNums+"张图片！");
                }
            },
            isOutOfRange: function(){
                return curSaveNums >= maxSaveNums;
            },
            onComplete: function(filename, response) {
                var upfname = response.file;
                if(upfname == ""){
                    _global.promote.alertPopup("图片上传失败！");
                }else{
                    curSaveNums++;
                    var crs = $('#upload_image').val();
                    $('#upload_image').val(crs + (crs != "" ? '#' : '') + upfname);
                    $("#upload-files").append(
                        '<div class="upload-item">' +
                        '<img src="/Uploads/'+response.file+'"/>' +
                        '<i class="del" onclick="delImage(this)"></i>' +
                        '</div>'
                    );
                }
            }
        });
    }
	require(['refund/ReturnBase']);
</script>
</body>
</html>
